package com.agmte.api.app.entity;

import com.agmte.api.app.entity.pojo.ApiMapper;
import com.agmte.api.common.crud.annotation.FieldAnno;
import com.agmte.api.common.crud.annotation.FieldId;
import com.agmte.api.common.crud.annotation.TableAnno;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;


@Data
@TableAnno(value = "api_user", describe = "用户表")

public class ApiUser {
    @FieldId

    private Long id;

    @FieldAnno(value = "name", desc = "姓名")
    private String name;

    @FieldAnno("age")
    private Integer age;

    @FieldAnno("email")
    private String email;

    @FieldAnno("group_id")
    private String groupId;

    @FieldAnno("description")
    private String description;

    @FieldAnno(value = "mappers", desc = "mapper定义")
    @NotEmpty(message = "必定mapper定义")
    @Valid
    private List<ApiMapper> mappers;
    // getters and setters
    // toString()


    public ApiUser() {
    }

    public ApiUser(String name, Integer age, String email) {
        this.name = name;
        this.age = age;
        this.email = email;
    }
}